package restful.struts2.app3;

import static restful.struts2.ResponseWriters.*;

import java.util.*;

import javax.ws.rs.*;

import restful.struts2.*;

@Path("/time")
public class TimeAction {

	private String time;

	@GET
	public ResponseWriter time() {
		newTime();
		return ok();
	}

	private void newTime() {
		time = new Date().toString();
	}

	@GET
	@Path("no-cache")
	public ResponseWriter timeNoCache() {
		newTime();
		return ok().noCache();
	}

	public String getTime() {
		return time;
	}
}
